package com.kaichaohulian.baocms.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.google.gson.Gson;
import com.kaichaohulian.baocms.R;
import com.kaichaohulian.baocms.app.ActivityUtil;
import com.kaichaohulian.baocms.app.MyApplication;
import com.kaichaohulian.baocms.base.BaseMyActivity;
import com.kaichaohulian.baocms.http.HttpUtil;
import com.kaichaohulian.baocms.http.Url;
import com.kaichaohulian.baocms.newmodel.NewHotModel;
import com.kaichaohulian.baocms.utils.DBLog;
import com.kaichaohulian.baocms.view.ShowDialog;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import org.apache.http.Header;
import org.json.JSONObject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class KeFuListActivity extends BaseMyActivity {


    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.view_temp)
    View viewTemp;
    @BindView(R.id.exit_layout)
    LinearLayout exitLayout;
    @BindView(R.id.center_title_tv)
    TextView centerTitleTv;
    @BindView(R.id.tv_right_text)
    TextView tvRightText;
    @BindView(R.id.iv_image)
    ImageView ivImage;
    @BindView(R.id.iv_image1)
    ImageView ivImage1;
    @BindView(R.id.navigation_bar)
    RelativeLayout navigationBar;
    @BindView(R.id.recycleview_kefulist)
    RecyclerView recycleviewKefulist;
    @BindView(R.id.activity_online_service)
    LinearLayout activityOnlineService;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_onlinelist);
        ButterKnife.bind(this);
        getKeFuData();
    }

    @OnClick({R.id.iv_back, R.id.view_temp, R.id.exit_layout, R.id.center_title_tv, R.id.tv_right_text, R.id.iv_image, R.id.iv_image1, R.id.navigation_bar, R.id.activity_online_service})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.view_temp:
                break;
            case R.id.exit_layout:
                break;
            case R.id.center_title_tv:
                break;
            case R.id.tv_right_text:
//                ActivityUtil.next(KeFuListActivity.this, OnlineServiceActivity.class);
                ActivityUtil.next(KeFuListActivity.this, WoYaoZiXunActivity.class);
                break;
            case R.id.iv_image:
                break;
            case R.id.iv_image1:
                break;
            case R.id.navigation_bar:
                break;
            case R.id.activity_online_service:
                break;
        }
    }


    public void getKeFuData() {


        final RequestParams params = new RequestParams();
        params.put("userId", MyApplication.getInstance().UserInfo.getUserId());
        params.put("page", 1);

        HttpUtil.post(Url.KEFU_LIST, params, new JsonHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
                Log.d(response.toString(), "333333333333333");
                NewHotModel newXuqiuModel = new NewHotModel();
                Gson gson = new Gson();


            }

            @Override
            public void onFinish() {
            }

            @Override
            public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
                DBLog.e("tag", statusCode + ":" + responseString);
                ShowDialog.dissmiss();

            }

            @Override
            public void onCancel() {
//                Toast.makeText(getActivity(), "请求取消", Toast.LENGTH_SHORT).show();
                ShowDialog.dissmiss();
            }
        });

    }

}
